#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/stattext.h>
#include <wx/valtext.h>

#include "dlgsetscore.h"

/** 
* @brief Ctor
* 
* @param iParent the parent window
* @param iScores buffers for players' scores 
*/
DlgSetScore::DlgSetScore(wxWindow *iParent, wxString (*iScores)[4]):
    wxDialog(iParent, wxID_ANY, _("Set players\' score"))
{
    static const wxString players[] = 
    {
        wxTRANSLATE("Red   "),
        wxTRANSLATE("Green "),
        wxTRANSLATE("Blue  "),
        wxTRANSLATE("Yellow")
    }; /*     static const wxString players[] =  */
    wxBoxSizer *tops = new wxBoxSizer(wxVERTICAL);
    
    wxBoxSizer *hs;
    for(int i = 0; i < WXSIZEOF(players); ++i)
    {
        hs = new wxBoxSizer(wxHORIZONTAL);
        hs->Add(new wxStaticText(this, wxID_ANY, players[i]), 0, wxALL, 2);
        hs->Add(new wxTextCtrl(this, wxID_ANY, wxEmptyString,
                    wxDefaultPosition, wxDefaultSize, 0,
                    wxTextValidator(wxFILTER_NUMERIC, &((*iScores)[i]))), 1,
                wxEXPAND | wxALL, 2);
        tops->Add(hs, 0, wxEXPAND);
    } /*     for(int i = 0; i < WXSIZOF(players); ++i) */
    tops->Add(CreateSeparatedButtonSizer(wxOK | wxCANCEL));
    
    SetSizer(tops);
    tops->SetSizeHints(this);
} /* DlgSetScore::DlgSetScore(wxWindow *iParent, wxString *iScores[4]) */

